package com.ushine.design.design.c_behavioral_pattern.c_interpreter.b_example;

/**
 * 客户端测试类：解释器模式
 *
 * @author yls
 */
public class Client {
    public static void main(String[] args) {
        String instruction = "down run 10 and left move 20";
        commonFun(instruction);
        instruction = "up move 5 and down run 10 and left move 5";
        commonFun(instruction);
    }

    private static void commonFun(String instruction) {
        InstructionHandler handler = new InstructionHandler();
        handler.handle(instruction);

        String output = handler.output();
        System.out.println(output);
    }
}
